package cn.wit.summit.chwan.adapters;

import android.app.Activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bigkoo.convenientbanner.ConvenientBanner;
import com.facebook.drawee.view.SimpleDraweeView;
import com.flyco.tablayout.SlidingTabLayout;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.wit.summit.chwan.R;
import cn.wit.summit.chwan.models.db.DownLoadTaskTable;
import cn.wit.summit.chwan.models.dbmanager.DownloadTaskManager;
import cn.wit.summit.chwan.models.dto.GameListBaseBean;
import cn.wit.summit.chwan.models.dto.JumpBaseBean;
import cn.wit.summit.chwan.models.response.IndexBeanV3Response;
import cn.wit.summit.chwan.ui.activity.GamePlayTypeActivty;
import cn.wit.summit.chwan.ui.activity.SearchActivity;
import cn.wit.summit.chwan.ui.activity.TreviFountainListActivity;
import cn.wit.summit.chwan.ui.base.MyApplication;
import cn.wit.summit.chwan.utils.IntentUtil;
import cn.wit.summit.chwan.utils.StringUtils;
import cn.wit.summit.chwan.utils.UtilsMy;
import cn.wit.summit.chwan.widgets.DownloadViewStrokeV2Big;
import cn.wit.summit.chwan.widgets.ItemListPartView;
import cn.wit.summit.chwan.widgets.ItemListView;
import cn.wit.summit.chwan.widgets.MyGridView;
import cn.wit.summit.chwan.widgets.RoundRelativeLayout;

/**
 * Created by Alan on 2018/7/17.
 */

public class RecommendV2Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private List<ViewBean> mDatas;
    private Activity mContext;
    private LayoutInflater inflater;
    private Map<String, String> downTemp = new HashMap<>();
    private ViewPager viewPager;
    private GameLibraryTopAdapter mAdapter;

    public RecommendV2Adapter(Activity context, List<ViewBean> datas) {
        this.mContext = context;
        this.mDatas = datas;
        inflater = LayoutInflater.from(mContext);
    }

    public RecommendV2Adapter(Activity context, List<ViewBean> datas, ViewPager viewPager, GameLibraryTopAdapter mAdapter) {
        this.mContext = context;
        this.mDatas = datas;
        this.viewPager = viewPager;
        this.mAdapter = mAdapter;
        inflater = LayoutInflater.from(mContext);
    }

    public String getPoByGameId(String gameId) {
        String result = "";
        if (downTemp.size()>0 && downTemp.containsKey(gameId)){
            result = downTemp.get(gameId);
        }
        return result;
    }

    public GameListBaseBean getBeanData(int itemPo, int po) {
        if (mDatas.get(itemPo).getViewType() == ViewType.TYPE_CRACK_GAME
                || mDatas.get(itemPo).getViewType() == ViewType.TYPE_CRACK_GAME_V2) {
            JumpBaseBean tempJump = (JumpBaseBean) mDatas.get(itemPo).getObj();
            List<GameListBaseBean> list = tempJump.getGame_list();
            return list.get(0);
        } else if (mDatas.get(itemPo).getViewType() == ViewType.TYPE_LIST) {
            GameListBaseBean tempJump = (GameListBaseBean) mDatas.get(itemPo).getObj();
            return tempJump;
        }
        return null;
    }

    public void clearTempData () {
        downTemp.clear();
    }

    public void setAdPage(int num) {

    }

    public enum ViewType {
        TYPE_TOP,//顶部
        TYPE_LINE_22,//分割
        TYPE_TITLE_ONE,//item标题1
        TYPE_CRACK_GAME,//破解游戏
        TYPE_CRACK_GAME_V2,//破解游戏
        TYPE_GREAT_CRACK,//了不起的破解
        TYPE_GAME_STARTER,//游戏首发
        TYPE_GAME_HOT,//全网热门游戏
        TYPE_DAILY_NEW,//每日上新
        TYPE_TOP_HEIGHT1,
        TYPE_TOP_HEIGHT2,
        TYPE_TOP_HEIGHT3,
        TYPE_TOP_HEIGHT4,
        TYPE_TOP_HEIGHT5,
        TYPE_LIST
    }

    public static class ViewBean {
        ViewType viewType;
        Object obj;
        boolean isNotShowMore;

        public ViewBean() {
        }

        public ViewBean(ViewType viewType) {
            this.viewType = viewType;
            this.obj = null;
        }

        public ViewBean(ViewType viewType, Object obj) {
            this.viewType = viewType;
            this.obj = obj;
        }

        public ViewBean(ViewType viewType, Object obj, boolean isNotShowMore) {
            this.viewType = viewType;
            this.obj = obj;
            this.isNotShowMore = isNotShowMore;
        }

        public boolean isNotShowMore() {
            return isNotShowMore;
        }

        public void setNotShowMore(boolean notShowMore) {
            isNotShowMore = notShowMore;
        }

        public ViewType getViewType() {
            return viewType;
        }

        public void setViewType(ViewType viewType) {
            this.viewType = viewType;
        }

        public Object getObj() {
            return obj;
        }

        public void setObj(Object obj) {
            this.obj = obj;
        }
    }

    //设置ITEM类型，可以自由发挥，这里设置item position单数显示item1 偶数显示item2
    @Override
    public int getItemViewType(int position) {
        if (mDatas != null) {
            return mDatas.get(position).getViewType().ordinal();
        }
        return -1;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        RecyclerView.ViewHolder holder = null;

        //加载Item View的时候根据不同TYPE加载不同的布局
        if (viewType == ViewType.TYPE_LINE_22.ordinal()) {
            holder = new Line22Holder(inflater.inflate(R.layout.item_recommend_v2_line22_view, parent, false));
        } else if (viewType == ViewType.TYPE_TOP_HEIGHT1.ordinal()) {
            holder = new TopHeightOneHolder(inflater.inflate(R.layout.part_game_lib_top_one_view, parent, false));
        } else if (viewType == ViewType.TYPE_TOP_HEIGHT2.ordinal()) {
            holder = new TopHeightTwoHolder(inflater.inflate(R.layout.part_game_lib_top_two_view, parent, false));
        } else if (viewType == ViewType.TYPE_TOP_HEIGHT3.ordinal()) {
            holder = new TopHeightThreeHolder(inflater.inflate(R.layout.part_game_lib_top_three_view, parent, false));
        } else if (viewType == ViewType.TYPE_TOP_HEIGHT4.ordinal()) {
            holder = new TopHeightFourHolder(inflater.inflate(R.layout.part_game_lib_top_four_view, parent, false));
        } else if (viewType == ViewType.TYPE_TOP_HEIGHT5.ordinal()) {
            holder = new TopHeightFiveHolder(inflater.inflate(R.layout.part_game_lib_top_five_view, parent, false));
        } else if (viewType == ViewType.TYPE_TOP.ordinal()) {
            holder = new TopHolder(inflater.inflate(R.layout.part_recommend_fragment_top_bar, parent, false));
        } else if (viewType == ViewType.TYPE_TITLE_ONE.ordinal()) {
            holder = new TitleOneHolder(inflater.inflate(R.layout.item_recommend_v2_titleone_view, parent, false));
        } else if (viewType == ViewType.TYPE_DAILY_NEW.ordinal()) {
            holder = new DailyNewHolder(inflater.inflate(R.layout.item_recommend_v2_dailynew_view, parent, false));
        } else if (viewType == ViewType.TYPE_CRACK_GAME.ordinal()) {
            holder = new CrackGameHolder(inflater.inflate(R.layout.item_recommend_v2_crackgame_view, parent, false));
        } else if (viewType == ViewType.TYPE_CRACK_GAME_V2.ordinal()) {
            holder = new CrackGameHolder(inflater.inflate(R.layout.item_recommend_v2_crackgame_v2_view, parent, false));
        } else if (viewType == ViewType.TYPE_GAME_STARTER.ordinal()) {
            holder = new GameStarterHolder(inflater.inflate(R.layout.item_recommend_v2_gamestarter_view, parent, false));
        } else if (viewType == ViewType.TYPE_GREAT_CRACK.ordinal()) {
            holder = new GreatCrackHolder(inflater.inflate(R.layout.item_recommend_v2_greatcrack_v2_view, parent, false));
        } else if (viewType == ViewType.TYPE_GAME_HOT.ordinal()) {
            holder = new GameHotHolder(inflater.inflate(R.layout.item_recommend_v2_gamehot_view, parent, false));
        } else if (viewType == ViewType.TYPE_LIST.ordinal()) {
            holder = new ListHolder(inflater.inflate(R.layout.item_daily_new_list_view, parent, false));
        }
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        RecommendV2Adapter.ViewBean viewBean = mDatas.get(position);
        if (holder instanceof Line22Holder) {
        } else if (holder instanceof TopHeightFiveHolder) {
            TopHeightFiveHolder topHeightHolder = (TopHeightFiveHolder) holder;

            topHeightHolder.itemTopLeftLl.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mContext.startActivity(new Intent(mContext, GamePlayTypeActivty.class));
                }
            });
            topHeightHolder.itemTopRightLl.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mContext.startActivity(new Intent(mContext, TreviFountainListActivity.class));
                }
            });
        } else if (holder instanceof TopHeightFourHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            TopHeightFourHolder topHeightHolder = (TopHeightFourHolder) holder;

            topHeightHolder.gameLibTopIv.setVisibility(View.VISIBLE);
            topHeightHolder.gameLibTopIv.setImageURI(temp.getJump_cover_big_pic());
            topHeightHolder.gameLibTopIv.setOnClickListener(new MyListener(mContext, temp));
        } else if (holder instanceof TopHeightOneHolder) {
            final List<JumpBaseBean> temp = (List<JumpBaseBean>) viewBean.getObj();
            TopHeightOneHolder topHeightHolder = (TopHeightOneHolder) holder;

//            topHeightHolder.gameLibTopIv.setVisibility(View.VISIBLE);
//            topHeightHolder.gameLibTopIv.setImageURI(temp.getJump_cover_big_pic());
//            topHeightHolder.gameLibTopIv.setOnClickListener(new MyListener(mContext, temp));

            UtilsMy.setRecommendGoods(mContext, topHeightHolder.vp_recommend, temp, true);
        } else if (holder instanceof TopHeightTwoHolder) {
            TopHeightTwoHolder topHeightHolder = (TopHeightTwoHolder) holder;
            if (mAdapter==null) {
                mAdapter = new GameLibraryTopAdapter(mContext, MyApplication.getMyApplication().getDiscoveryTypes());
            }
            topHeightHolder.gameLibGv.setAdapter(mAdapter);
        } else if (holder instanceof TopHeightThreeHolder) {
            TopHeightThreeHolder topHeightHolder = (TopHeightThreeHolder) holder;
            if (viewPager!=null) {
                topHeightHolder.activityDetailTabs.setViewPager(viewPager);
            }
        } else if (holder instanceof TopHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            TopHolder topHolder = (TopHolder) holder;

            topHolder.layout_search_ll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mContext.startActivity(new Intent(mContext, SearchActivity.class));
                }
            });
        } else if (holder instanceof TitleOneHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            TitleOneHolder titleOneHolder = (TitleOneHolder) holder;

            titleOneHolder.itemDailyNewTitleTx.setText(temp.getJump_title());
            temp.getJump_info().setJump_position("0");
            if (!viewBean.isNotShowMore) {
                titleOneHolder.itemDailyNewTitleMoreTx.setVisibility(View.VISIBLE);
                titleOneHolder.itemDailyNewRootLl.setOnClickListener(new MyListener(mContext, temp));
            } else {
                titleOneHolder.itemDailyNewTitleMoreTx.setVisibility(View.INVISIBLE);
            }
        } else if (holder instanceof ListHolder) {
            GameListBaseBean temp = (GameListBaseBean) viewBean.getObj();
            ListHolder listHolder = (ListHolder) holder;

            downTemp.put(temp.getGame_id(), position + "");
            listHolder.listItem.hitLine();
            listHolder.listItem.setDataNotagInfo(mContext, temp);
        } else if (holder instanceof DailyNewHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            DailyNewHolder dailyNewHolder = (DailyNewHolder) holder;

            dailyNewHolder.itemDailyNewRootLl.setOnClickListener(new MyListener(mContext, temp));
            dailyNewHolder.itemDailyNewOneLl.setVisibility(View.INVISIBLE);
            dailyNewHolder.itemDailyNewTwoLl.setVisibility(View.INVISIBLE);
            dailyNewHolder.itemDailyNewThreeLl.setVisibility(View.INVISIBLE);
            dailyNewHolder.itemDailyNewFourLl.setVisibility(View.INVISIBLE);
            for (int i=0;i<temp.getGame_list().size();i++) {
                GameListBaseBean gameListBaseBean = temp.getGame_list().get(i);
                String icoUrl = gameListBaseBean.getGame_ico();
                switch (i) {
                    case 0:
                        dailyNewHolder.itemDailyNewOneLl.setVisibility(View.VISIBLE);
                        dailyNewHolder.itemDailyNewOneTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            dailyNewHolder.itemDailyNewOneIv.setImageURI(icoUrl);
                        break;
                    case 1:
                        dailyNewHolder.itemDailyNewTwoLl.setVisibility(View.VISIBLE);
                        dailyNewHolder.itemDailyNewTwoTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            dailyNewHolder.itemDailyNewTwoIv.setImageURI(icoUrl);
                        break;
                    case 2:
                        dailyNewHolder.itemDailyNewThreeLl.setVisibility(View.VISIBLE);
                        dailyNewHolder.itemDailyNewThreeTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            dailyNewHolder.itemDailyNewThreeIv.setImageURI(icoUrl);
                        break;
                    case 3:
                        dailyNewHolder.itemDailyNewFourLl.setVisibility(View.VISIBLE);
                        dailyNewHolder.itemDailyNewFourTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            dailyNewHolder.itemDailyNewFourIv.setImageURI(icoUrl);
                        break;
                }
            }
        } else if (holder instanceof CrackGameHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            CrackGameHolder crackGameHolder = (CrackGameHolder) holder;
            String bgUrl = temp.getJump_cover_big_pic();
            if (!StringUtils.isEmpty(bgUrl))
                crackGameHolder.itemCrackGameBgIv.setImageURI(bgUrl);

            String pojie = temp.getJump_title();
            if (StringUtils.isEmpty(pojie)) {
                crackGameHolder.imageViewTypeNumTv.setVisibility(View.INVISIBLE);
            } else {
                crackGameHolder.imageViewTypeNumTv.setVisibility(View.VISIBLE);
                crackGameHolder.imageViewTypeNumTv.setText(pojie);
            }

            GameListBaseBean gameListBaseBean = null;
            if (temp.getGame_list()!=null && temp.getGame_list().size()>0) {
                gameListBaseBean = temp.getGame_list().get(0);
            }
            if (gameListBaseBean != null) {
                DownLoadTaskTable taskTable = DownloadTaskManager.getInstance().findByGameId(gameListBaseBean.getGame_id());
                IndexBeanV3Response.CreditInfoBean tempBean = gameListBaseBean.getCredit_info();
                if (tempBean!=null && tempBean.getDay_surplus()>0 && tempBean.getGame_down_load_reward()>0
                        && (taskTable==null || taskTable.getDownStatus()==0)) {
                    crackGameHolder.itemCrackGameMoneyTv.setVisibility(View.VISIBLE);
                    crackGameHolder.itemCrackGameMoneyTv.setText("+ " + tempBean.getGame_down_load_reward() + "元");
                } else {
                    crackGameHolder.itemCrackGameMoneyTv.setVisibility(View.INVISIBLE);
                }
                crackGameHolder.itemCrackGameNameTx.setText(gameListBaseBean.getGame_name());
                String subTitle = temp.getJump_sub_title();
                if (StringUtils.isEmpty(subTitle))
                    subTitle = gameListBaseBean.getGame_info();
                crackGameHolder.itemCrackGameSubTitleTx.setText(subTitle);
                downTemp.put(gameListBaseBean.getGame_id(), position+"");
                crackGameHolder.itemCrackGameBt.initData(gameListBaseBean.getGame_id(), gameListBaseBean);

                String icoUrl = gameListBaseBean.getGame_ico();
                if (!StringUtils.isEmpty(icoUrl))
                    crackGameHolder.itemCrackGameIv.setImageURI(icoUrl);
            }

            crackGameHolder.itemCrackGameRootFl.setOnClickListener(new MyListener(mContext, temp));
        } else if (holder instanceof GameStarterHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            GameStarterHolder gameStarterHolder = (GameStarterHolder) holder;

            String icoUrl = temp.getJump_cover_big_pic();
            if (!StringUtils.isEmpty(icoUrl))
                gameStarterHolder.itemGameStarterIv.setImageURI(icoUrl);

            gameStarterHolder.itemGameStarterFl.setOnClickListener(new MyListener(mContext, temp));
        } else if (holder instanceof GreatCrackHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            GreatCrackHolder greatCrackHolder = (GreatCrackHolder) holder;

            greatCrackHolder.roundRelativeLayout.setRectAdius(mContext.getResources().getDimension(R.dimen.wdp16));

            String bgUrl = temp.getJump_cover_big_pic();
            if (!StringUtils.isEmpty(bgUrl))
                greatCrackHolder.itemGreatCrackBgIv.setImageURI(bgUrl);

            greatCrackHolder.itemGreatCrackTitleTx.setText(temp.getJump_title());
            greatCrackHolder.itemGreatCrackRootFl.setOnClickListener(new MyListener(mContext, temp));
            greatCrackHolder.itemGreatCrackOneLl.setVisibility(View.GONE);
            greatCrackHolder.itemGreatCrackTwoLl.setVisibility(View.GONE);
            greatCrackHolder.itemGreatCrackThreeLl.setVisibility(View.GONE);
            for (int i=0;i<temp.getGame_list().size();i++) {
                GameListBaseBean gameListBaseBean = temp.getGame_list().get(i);
                String icoUrl = gameListBaseBean.getGame_ico();
                switch (i) {
                    case 0:
                        greatCrackHolder.itemGreatCrackOneLl.setVisibility(View.VISIBLE);
                        greatCrackHolder.itemGreatCrackOneTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            greatCrackHolder.itemGreatCrackOneIv.setImageURI(icoUrl);
                        break;
                    case 1:
                        greatCrackHolder.itemGreatCrackTwoLl.setVisibility(View.VISIBLE);
                        greatCrackHolder.itemGreatCrackTwoTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            greatCrackHolder.itemGreatCrackTwoIv.setImageURI(icoUrl);
                        break;
                    case 2:
                        greatCrackHolder.itemGreatCrackThreeLl.setVisibility(View.VISIBLE);
                        greatCrackHolder.itemGreatCrackThreeTv.setText(gameListBaseBean.getGame_name());
                        if (!StringUtils.isEmpty(icoUrl))
                            greatCrackHolder.itemGreatCrackThreeIv.setImageURI(icoUrl);
                        break;
                }
            }
        } else if (holder instanceof GameHotHolder) {
            final JumpBaseBean temp = (JumpBaseBean) viewBean.getObj();
            GameHotHolder gameHotHolder = (GameHotHolder) holder;

            String jumpTime = temp.getJump_time();
            if (temp.getJump_info().getJump_type().equals("22")) {
                gameHotHolder.itemGameHotTimeLl.setVisibility(View.GONE);
            } else {
                if (!StringUtils.isEmpty(jumpTime)) {
                    gameHotHolder.itemGameHotTimeLl.setVisibility(View.VISIBLE);
                    gameHotHolder.itemGameHotTimeTv.setText("最后更新时间："+jumpTime);
                } else {
                    gameHotHolder.itemGameHotTimeLl.setVisibility(View.GONE);
                }
            }
            gameHotHolder.itemGameHotOneLl.setVisibility(View.INVISIBLE);
            gameHotHolder.itemGameHotTwoLl.setVisibility(View.INVISIBLE);
            gameHotHolder.itemGameHotThreeLl.setVisibility(View.INVISIBLE);
            gameHotHolder.itemGameHotFourLl.setVisibility(View.INVISIBLE);
            for (int i=0;i<temp.getGame_list().size();i++) {
                GameListBaseBean gameListBaseBean = temp.getGame_list().get(i);
                String icoUrl = gameListBaseBean.getGame_ico();
                String tempStr = gameListBaseBean.getGame_title();
                switch (i) {
                    case 0:
                        gameHotHolder.itemGameHotOneLl.setVisibility(View.VISIBLE);
                        gameHotHolder.itemGameHotOneLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                temp.getJump_info().setJump_position("0");
                                IntentUtil.getInstance().intentTo(mContext, temp);
                            }
                        });
                        gameHotHolder.itemGameHotOneTv.setText(gameListBaseBean.getGame_name());
                        if (StringUtils.isEmpty(tempStr)) {
                            gameHotHolder.itemGameHotRankOneTv.setVisibility(View.GONE);
                        } else {
                            gameHotHolder.itemGameHotRankOneTv.setVisibility(View.VISIBLE);
                            gameHotHolder.itemGameHotRankOneTv.setText(tempStr);
                        }
                        if (!StringUtils.isEmpty(icoUrl))
                            gameHotHolder.itemGameHotOneIv.setImageURI(icoUrl);
                        break;
                    case 1:
                        gameHotHolder.itemGameHotTwoLl.setVisibility(View.VISIBLE);
                        gameHotHolder.itemGameHotTwoLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                temp.getJump_info().setJump_position("1");
                                IntentUtil.getInstance().intentTo(mContext, temp);
                            }
                        });
                        gameHotHolder.itemGameHotTwoTv.setText(gameListBaseBean.getGame_name());
                        if (StringUtils.isEmpty(tempStr)) {
                            gameHotHolder.itemGameHotRankTwoTv.setVisibility(View.GONE);
                        } else {
                            gameHotHolder.itemGameHotRankTwoTv.setVisibility(View.VISIBLE);
                            gameHotHolder.itemGameHotRankTwoTv.setText(tempStr);
                        }
                        if (!StringUtils.isEmpty(icoUrl))
                            gameHotHolder.itemGameHotTwoIv.setImageURI(icoUrl);
                        break;
                    case 2:
                        gameHotHolder.itemGameHotThreeLl.setVisibility(View.VISIBLE);
                        gameHotHolder.itemGameHotThreeLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                temp.getJump_info().setJump_position("2");
                                IntentUtil.getInstance().intentTo(mContext, temp);
                            }
                        });
                        gameHotHolder.itemGameHotThreeTv.setText(gameListBaseBean.getGame_name());
                        if (StringUtils.isEmpty(tempStr)) {
                            gameHotHolder.itemGameHotRankThreeTv.setVisibility(View.GONE);
                        } else {
                            gameHotHolder.itemGameHotRankThreeTv.setVisibility(View.VISIBLE);
                            gameHotHolder.itemGameHotRankThreeTv.setText(tempStr);
                        }
                        if (!StringUtils.isEmpty(icoUrl))
                            gameHotHolder.itemGameHotThreeIv.setImageURI(icoUrl);
                        break;
                    case 3:
                        gameHotHolder.itemGameHotFourLl.setVisibility(View.VISIBLE);
                        gameHotHolder.itemGameHotFourLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                temp.getJump_info().setJump_position("3");
                                IntentUtil.getInstance().intentTo(mContext, temp);
                            }
                        });
                        gameHotHolder.itemGameHotFourTv.setText(gameListBaseBean.getGame_name());
                        if (StringUtils.isEmpty(tempStr)) {
                            gameHotHolder.itemGameHotRankFourTv.setVisibility(View.GONE);
                        } else {
                            gameHotHolder.itemGameHotRankFourTv.setVisibility(View.VISIBLE);
                            gameHotHolder.itemGameHotRankFourTv.setText(tempStr);
                        }
                        if (!StringUtils.isEmpty(icoUrl))
                            gameHotHolder.itemGameHotFourIv.setImageURI(icoUrl);
                        break;
                }
            }
        }
    }

    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    private class MyListener implements View.OnClickListener {

        private Activity context;
        private JumpBaseBean tempBean;

        public MyListener(Activity context, JumpBaseBean temp) {
            this.context = context;
            this.tempBean = temp;
        }

        @Override
        public void onClick(View v) {
            IntentUtil.getInstance().intentTo(context, tempBean);
        }
    }

    public class TopHolder extends RecyclerView.ViewHolder {
        LinearLayout layout_search_ll;

        public TopHolder(View view) {
            super(view);
            layout_search_ll = view.findViewById(R.id.layout_search_ll);
        }
    }

    public class Line22Holder extends RecyclerView.ViewHolder {
        public Line22Holder(View view) {
            super(view);
        }
    }

    public class TopHeightOneHolder extends RecyclerView.ViewHolder {
        SimpleDraweeView gameLibTopIv;
        ConvenientBanner vp_recommend;

        public TopHeightOneHolder(View view) {
            super(view);
            gameLibTopIv = view.findViewById(R.id.gameLibTopIv);
            vp_recommend = view.findViewById(R.id.vp_recommend);
        }
    }

    public class TopHeightFourHolder extends RecyclerView.ViewHolder {
        SimpleDraweeView gameLibTopIv;

        public TopHeightFourHolder(View view) {
            super(view);
            gameLibTopIv = view.findViewById(R.id.gameLibTopIv);
        }
    }

    public class TopHeightFiveHolder extends RecyclerView.ViewHolder {
        RelativeLayout itemTopLeftLl;
        RelativeLayout itemTopRightLl;

        public TopHeightFiveHolder(View view) {
            super(view);
            itemTopLeftLl = view.findViewById(R.id.itemTopLeftLl);
            itemTopRightLl = view.findViewById(R.id.itemTopRightLl);
        }
    }

    public class TopHeightTwoHolder extends RecyclerView.ViewHolder {
        MyGridView gameLibGv;

        public TopHeightTwoHolder(View view) {
            super(view);
            gameLibGv = view.findViewById(R.id.gameLibGv);
        }
    }

    public class TopHeightThreeHolder extends RecyclerView.ViewHolder {
        SlidingTabLayout activityDetailTabs;

        public TopHeightThreeHolder(View view) {
            super(view);
            activityDetailTabs = view.findViewById(R.id.activityDetailTabs);
        }
    }

    public class TitleOneHolder extends RecyclerView.ViewHolder {
        LinearLayout itemDailyNewRootLl;
        TextView itemDailyNewTitleTx;
        TextView itemDailyNewTitleMoreTx;

        public TitleOneHolder(View view) {
            super(view);
            itemDailyNewRootLl = view.findViewById(R.id.itemDailyNewRootLl);
            itemDailyNewTitleTx = view.findViewById(R.id.itemDailyNewTitleTx);
            itemDailyNewTitleMoreTx = view.findViewById(R.id.itemDailyNewTitleMoreTx);
        }
    }

    public class DailyNewHolder extends RecyclerView.ViewHolder {
        LinearLayout itemDailyNewRootLl;
        TextView itemDailyNewTitleTx;
        TextView itemDailyNewTitleMoreTx;
        LinearLayout itemDailyNewOneLl;
        SimpleDraweeView itemDailyNewOneIv;
        TextView itemDailyNewOneTv;
        LinearLayout itemDailyNewTwoLl;
        SimpleDraweeView itemDailyNewTwoIv;
        TextView itemDailyNewTwoTv;
        LinearLayout itemDailyNewThreeLl;
        SimpleDraweeView itemDailyNewThreeIv;
        TextView itemDailyNewThreeTv;
        LinearLayout itemDailyNewFourLl;
        SimpleDraweeView itemDailyNewFourIv;
        TextView itemDailyNewFourTv;

        public DailyNewHolder(View view) {
            super(view);
            itemDailyNewRootLl = view.findViewById(R.id.itemDailyNewRootLl);
            itemDailyNewTitleTx = view.findViewById(R.id.itemDailyNewTitleTx);
            itemDailyNewTitleMoreTx = view.findViewById(R.id.itemDailyNewTitleMoreTx);
            itemDailyNewOneLl = view.findViewById(R.id.itemDailyNewOneLl);
            itemDailyNewOneIv = view.findViewById(R.id.itemDailyNewOneIv);
            itemDailyNewOneTv = view.findViewById(R.id.itemDailyNewOneTv);
            itemDailyNewTwoLl = view.findViewById(R.id.itemDailyNewTwoLl);
            itemDailyNewTwoIv = view.findViewById(R.id.itemDailyNewTwoIv);
            itemDailyNewTwoTv = view.findViewById(R.id.itemDailyNewTwoTv);
            itemDailyNewThreeLl = view.findViewById(R.id.itemDailyNewThreeLl);
            itemDailyNewThreeIv = view.findViewById(R.id.itemDailyNewThreeIv);
            itemDailyNewThreeTv = view.findViewById(R.id.itemDailyNewThreeTv);
            itemDailyNewFourLl = view.findViewById(R.id.itemDailyNewFourLl);
            itemDailyNewFourIv = view.findViewById(R.id.itemDailyNewFourIv);
            itemDailyNewFourTv = view.findViewById(R.id.itemDailyNewFourTv);
        }
    }

    public class CrackGameHolder extends RecyclerView.ViewHolder {
        FrameLayout itemCrackGameRootFl;
        SimpleDraweeView itemCrackGameBgIv;
        SimpleDraweeView itemCrackGameIv;
        TextView itemCrackGameNameTx;
        TextView itemCrackGameSubTitleTx;
        TextView imageViewTypeNumTv;
        TextView itemCrackGameMoneyTv;
        DownloadViewStrokeV2Big itemCrackGameBt;

        public CrackGameHolder(View view) {
            super(view);
            itemCrackGameRootFl = view.findViewById(R.id.itemCrackGameRootFl);
            itemCrackGameBgIv = view.findViewById(R.id.itemCrackGameBgIv);
            itemCrackGameIv = view.findViewById(R.id.itemCrackGameIv);
            itemCrackGameMoneyTv = view.findViewById(R.id.itemCrackGameMoneyTv);
            itemCrackGameNameTx = view.findViewById(R.id.itemCrackGameNameTx);
            itemCrackGameSubTitleTx = view.findViewById(R.id.itemCrackGameSubTitleTx);
            imageViewTypeNumTv = view.findViewById(R.id.imageViewTypeNumTv);
            itemCrackGameBt = view.findViewById(R.id.itemCrackGameBt);
        }
    }

    public class GameStarterHolder extends RecyclerView.ViewHolder {
        FrameLayout itemGameStarterFl;
        SimpleDraweeView itemGameStarterIv;

        public GameStarterHolder(View view) {
            super(view);
            itemGameStarterFl = view.findViewById(R.id.itemGameStarterFl);
            itemGameStarterIv = view.findViewById(R.id.itemGameStarterIv);
        }
    }

    public class GreatCrackHolder extends RecyclerView.ViewHolder {
        RoundRelativeLayout roundRelativeLayout;
        FrameLayout itemGreatCrackRootFl;
        SimpleDraweeView itemGreatCrackBgIv;
        TextView itemGreatCrackTitleTx;
        TextView itemGreatCrackTitleMoreTx;
        LinearLayout itemGreatCrackOneLl;
        SimpleDraweeView itemGreatCrackOneIv;
        TextView itemGreatCrackOneTv;
        LinearLayout itemGreatCrackTwoLl;
        SimpleDraweeView itemGreatCrackTwoIv;
        TextView itemGreatCrackTwoTv;
        LinearLayout itemGreatCrackThreeLl;
        SimpleDraweeView itemGreatCrackThreeIv;
        TextView itemGreatCrackThreeTv;

        public GreatCrackHolder(View view) {
            super(view);
            roundRelativeLayout = view.findViewById(R.id.roundRelativeLayout);
            itemGreatCrackRootFl = view.findViewById(R.id.itemGreatCrackRootFl);
            itemGreatCrackBgIv = view.findViewById(R.id.itemGreatCrackBgIv);
            itemGreatCrackTitleTx = view.findViewById(R.id.itemGreatCrackTitleTx);
            itemGreatCrackTitleMoreTx = view.findViewById(R.id.itemGreatCrackTitleMoreTx);
            itemGreatCrackOneLl = view.findViewById(R.id.itemGreatCrackOneLl);
            itemGreatCrackOneIv = view.findViewById(R.id.itemGreatCrackOneIv);
            itemGreatCrackOneTv = view.findViewById(R.id.itemGreatCrackOneTv);
            itemGreatCrackTwoLl = view.findViewById(R.id.itemGreatCrackTwoLl);
            itemGreatCrackTwoIv = view.findViewById(R.id.itemGreatCrackTwoIv);
            itemGreatCrackTwoTv = view.findViewById(R.id.itemGreatCrackTwoTv);
            itemGreatCrackThreeLl = view.findViewById(R.id.itemGreatCrackThreeLl);
            itemGreatCrackThreeIv = view.findViewById(R.id.itemGreatCrackThreeIv);
            itemGreatCrackThreeTv = view.findViewById(R.id.itemGreatCrackThreeTv);
        }
    }

    public class GameHotHolder extends RecyclerView.ViewHolder {
        LinearLayout itemGameHotRootLl;
        LinearLayout itemGameHotOneLl;
        SimpleDraweeView itemGameHotOneIv;
        TextView itemGameHotOneTv;
        TextView itemGameHotRankOneTv;
        LinearLayout itemGameHotTwoLl;
        SimpleDraweeView itemGameHotTwoIv;
        TextView itemGameHotTwoTv;
        TextView itemGameHotRankTwoTv;
        LinearLayout itemGameHotThreeLl;
        SimpleDraweeView itemGameHotThreeIv;
        TextView itemGameHotThreeTv;
        TextView itemGameHotRankThreeTv;
        LinearLayout itemGameHotFourLl;
        SimpleDraweeView itemGameHotFourIv;
        TextView itemGameHotFourTv;
        TextView itemGameHotRankFourTv;
        LinearLayout itemGameHotTimeLl;
        TextView itemGameHotTimeTv;

        public GameHotHolder(View view) {
            super(view);
            itemGameHotRootLl = view.findViewById(R.id.itemGameHotRootLl);
            itemGameHotOneLl = view.findViewById(R.id.itemGameHotOneLl);
            itemGameHotOneIv = view.findViewById(R.id.itemGameHotOneIv);
            itemGameHotOneTv = view.findViewById(R.id.itemGameHotOneTv);
            itemGameHotRankOneTv = view.findViewById(R.id.itemGameHotRankOneTv);
            itemGameHotTwoLl = view.findViewById(R.id.itemGameHotTwoLl);
            itemGameHotTwoIv = view.findViewById(R.id.itemGameHotTwoIv);
            itemGameHotTwoTv = view.findViewById(R.id.itemGameHotTwoTv);
            itemGameHotRankTwoTv = view.findViewById(R.id.itemGameHotRankTwoTv);
            itemGameHotThreeLl = view.findViewById(R.id.itemGameHotThreeLl);
            itemGameHotThreeIv = view.findViewById(R.id.itemGameHotThreeIv);
            itemGameHotThreeTv = view.findViewById(R.id.itemGameHotThreeTv);
            itemGameHotRankThreeTv = view.findViewById(R.id.itemGameHotRankThreeTv);
            itemGameHotFourLl = view.findViewById(R.id.itemGameHotFourLl);
            itemGameHotFourIv = view.findViewById(R.id.itemGameHotFourIv);
            itemGameHotFourTv = view.findViewById(R.id.itemGameHotFourTv);
            itemGameHotRankFourTv = view.findViewById(R.id.itemGameHotRankFourTv);
            itemGameHotTimeLl = view.findViewById(R.id.itemGameHotTimeLl);
            itemGameHotTimeTv = view.findViewById(R.id.itemGameHotTimeTv);
        }
    }

    public class ListHolder extends RecyclerView.ViewHolder {
        ItemListView listItem;

        public ListHolder(View view) {
            super(view);
            listItem = view.findViewById(R.id.listItem);
        }
    }
}
